package com.jiazhong.cloud.config;

import com.alibaba.nacos.api.NacosFactory;
import com.alibaba.nacos.api.config.ConfigService;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.ConfigurableEnvironment;

import java.util.Map;
@Slf4j
@SpringBootApplication
public class CloudNacosConfigApplication {
    @SneakyThrows
    public static void main(String[] args) {
        ConfigurableApplicationContext bean = SpringApplication.run(CloudNacosConfigApplication.class, args);
        /*// 获取到配置文件
        ConfigurableEnvironment environment = bean.getEnvironment();
        // 获取到云端中的配置选项
        while(true){
            String id = environment.getProperty("student.id");
            String name = environment.getProperty("student.name");
            String gender = environment.getProperty("student.gender");
            log.info("id:{}, name:{}, gender:{}", id, name, gender);
            Thread.sleep(3000);
        }*/

    }
}